<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="renderer" content="webkit">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no,email=no,adress=no">
    <title>{$config.site_name}</title>
    <link rel="stylesheet" type="text/css" href="/static/home/css/bases.css" />
    <link rel="stylesheet" type="text/css" href="/static/home/css/index.css" />
    {block name="css"}{/block}
</head>

<body>

{include file="common/header" /}



{block name="content"}{/block}



{include file="common/footer" /}

<div class="contact_us">
    <div class="title">
        <span>联</span>
        <span>系</span>
        <span>我</span>
        <span>们</span>
    </div>
    <div class="content" style="display: none;">
        <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin={$config.site_qq}&site=qq&menu=yes">
            <img border="0" src="http://wpa.qq.com/pa?p=2:814876569:51" alt="联系我们" title="联系我们"/>
        </a>
        <div>
            {$config.site_contact_us}
        </div>
    </div>
</div>

<div class="message-board">
    <div class="title">
        客户留言
        <a href="javascript:;" class="m-open"></a>
    </div>
    <div class="form">
        <form action="/message/save" method="post" id="messageForm">
            <div class="form-item">
                <label>主题</label>
                <input name="title" type="text" placeholder="请输入主题" />
            </div>
            <div class="form-item">
                <label>联系人</label>
                <input name="name" type="text" placeholder="请输入联系人" />
            </div>
            <div class="form-item">
                <label>联系方式</label>
                <input name="tel" type="text" placeholder="请输入联系方式" />
            </div>
            <div class="form-item">
                <label>QQ</label>
                <input name="qq" type="text" placeholder="请输入QQ" />
            </div>
            <!--<div class="form-item">-->
                <!--<label>地址</label>-->
                <!--<input name="qq" type="text" placeholder="请输入地址" />-->
            <!--</div>-->
            <div class="form-item">
                <label>内容</label>
                <textarea name="content" placeholder="请输入内容" ></textarea>
            </div>
            <div class="form-item">
                <button type="button" class="ajax-submit">提交</button>
            </div>
        </form>
    </div>
</div>

<script type="text/javascript" src="/static/home/js/jquery-1.10.1.min.js"></script>
<script src="/static/home/js/js.js"></script>
<script>
    $('.ajax-submit').click(function () {
        var url = $('#messageForm').attr('action');
        var data = $('#messageForm').serialize();
        $.post(url,data,function (res) {
            alert(res.msg);
            if (res.code == 1){
                $('#messageForm').find('input').val('');
                $('#messageForm').find('textarea').val('');
            }

        });
    });
    $('.contact_us').mouseup(function () {
        $(this).find('.content').toggle();
    });
    $('.m-open').click(function () {
        $('.message-board .form').toggle();
    });
    // 分页
    var page = function (dom, page, pageSize, listTotal) {

        if (listTotal <= 0){
            return false;
        }
        var pageNum = Math.ceil(listTotal/pageSize);
        var prevPage = page - 1 >= 1 ? page - 1 : 1;
        var nextPage = page + 1 <= pageNum ?　page + 1 : pageNum;
        var pageStr = '?page=';
        var search = window.location.search;
        if (search !== ''){
            pageStr = search + '&page=';
        }
        var html = '<ul class="tt"><li class="tta"><a href="' + pageStr + prevPage + '"><</a></li>';
        for (var i = 1; i <= pageNum; i++){
            if ( i === parseInt(page)){
                html += '<li><a href="' + pageStr + i + '">' + i + '</a></li>'
            }else{
                html += '<li  class="tta"><a href="?page=' + i + '">' + i + '</a></li>'
            }
        }
        html += '<li class="tta"><a href="'+ pageStr + nextPage + '">></a></li></ul>';
        $(dom).html(html);
    };

</script>
{block name="js"}

{/block}
</body>
</html>
